'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1996, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ELF_KIND 3ELF "Jul 11, 2001"
.SH NAME
elf_kind \- determine file type
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lelf\fR [ \fIlibrary\fR ... ]
#include <libelf.h>

\fBElf_Kind\fR \fBelf_kind\fR(\fBElf *\fR\fIelf\fR);
.fi

.SH DESCRIPTION
.sp
.LP
This function returns a value identifying the kind of file associated with an
\fBELF\fR descriptor (\fIelf\fR). Defined values are below:
.sp
.ne 2
.na
\fB\fBELF_K_AR\fR\fR
.ad
.RS 14n
The file is an archive [see \fBar.h\fR(3HEAD)]. An \fBELF\fR descriptor may
also be associated with an archive \fImember\fR, not the archive itself, and
then \fBelf_kind()\fR identifies the member's type.
.RE

.sp
.ne 2
.na
\fB\fBELF_K_COFF\fR\fR
.ad
.RS 14n
The file is a \fBCOFF\fR object file. \fBelf_begin\fR(3ELF) describes the
library's handling for \fBCOFF\fR files.
.RE

.sp
.ne 2
.na
\fB\fBELF_K_ELF\fR\fR
.ad
.RS 14n
The file is an \fBELF\fR file. The program may use \fBelf_getident()\fR to
determine the class. Other functions, such as \fBelf32_getehdr()\fR, are
available to retrieve other file information.
.RE

.sp
.ne 2
.na
\fB\fBELF_K_NONE\fR\fR
.ad
.RS 14n
This indicates a kind of file unknown to the library.
.RE

.sp
.LP
Other values are reserved, to be assigned as needed to new kinds of files.
\fIelf\fR should be a value previously returned by \fBelf_begin()\fR. A null
pointer is allowed, to simplify error handling, and causes \fBelf_kind()\fR to
return \fBELF_K_NONE\fR.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Stable
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR elf (3ELF),
.BR elf32_getehdr (3ELF),
.BR elf_begin (3ELF),
.BR elf_getident (3ELF),
.BR ar.h (3HEAD),
.BR libelf (3LIB),
.BR attributes (7)
